from base_api.baseapi import BaseApi


class WeWork(BaseApi):
    # def __init__(self):
    #     super().__init__()
    #     # 实例化token，继承WeWork的类可以直接使用
    #     self.token = self.get_token()

    # 获取access_token鉴权
    def get_token(self, corpid, corpsecret):
        corpid = corpid
        corpsecret = corpsecret
        data = {
            "method":"GET",
            "url":"https://qyapi.weixin.qq.com/cgi-bin/gettoken",
            "params":{
                "corpid":corpid,
                "corpsecret":corpsecret
            }
        }
        return self.send(**data).json().get("access_token")
